package kylin.dao.impl;

import java.util.List;

import kylin.base.dao.BaseDaoImpl;
import kylin.dao.DocInterfaceMethodDao;
import kylin.entity.DocInterfaceMethod;

import org.springframework.stereotype.Repository;


@Repository
public class DocInterfaceMethodDaoImpl extends BaseDaoImpl<DocInterfaceMethod> implements DocInterfaceMethodDao{

	/**
	 * <p>Method Name : query</p>
	 * <p>Method Desc : 根据接口文档ID查询所有接口方法</p>
	 * <p>Date : 2015-11-6 上午12:37:26</p>
	 * <p>Author : XQL</p>
	 * @param docInterface_id 接口文档ID
	 * @return
	 */
	public List<DocInterfaceMethod> query(int docInterface_id){
		String hql = "from DocInterfaceMethod where docInterface.id = ?";
		return super.findByHQL(hql, docInterface_id);
	}

	/**
	 * <p>Method Name : queryByLike</p>
	 * <p>Method Desc : 模糊文档ID和方法名称 进行模糊查询</p>
	 * <p>Date : 2015-11-7 上午12:02:36</p>
	 * <p>Author : XQL</p>
	 * @param docInterface_id
	 * @param name
	 * @return
	 */
	public List<DocInterfaceMethod> queryByLike(int docInterface_id, String name){
		String hql = "from DocInterfaceMethod where docInterface.id = ? and (name like ? or descs like ?)";
		return super.findByHQL(hql, docInterface_id,"%" + name + "%","%" + name + "%");
	}
}
